package com.los;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import static java.util.stream.Collectors.toList;

/**
 * @program: java8
 * @description: stream特性之filter
 * @author: Yujuan
 * @create: 2018-06-14 10:06
 **/
public class StreamFilter {
    public static void main(String[] args) {
        List<Integer> integers= Arrays.asList(1,2,3,5,6,7,8,7,6,9,1,2);

        List<Integer> result=integers.stream().filter(integer -> integer%2==0).collect(toList());
        System.out.println(result);

        List<Integer> rd=integers.stream().distinct().collect(toList());
        System.out.println(rd);

        List<Integer> rs=integers.stream().skip(5).collect(toList());
        System.out.println(rs);

        List<Integer> rl=integers.stream().limit(5).collect(toList());
        System.out.println(rl);

    }
}
